package infaraway.Decorator;

import infaraway.Decorator.Decorator.Module1;
import infaraway.Decorator.Decorator.Module2;

/**
 * Created by :Infaraway
 * DATE : 2017/4/26
 * Time : 22:28
 * Funtion :
 */
public class Main {
    public static void main(String[] args) {
        Beverage beverage = new Coffee1();
        System.out.println(beverage.getDescription()+"  cost: "+beverage.cost());

        beverage = new Module1(beverage); //使用装饰类装饰对象
        System.out.println(beverage.getDescription()+"  cost: "+beverage.cost());

        Beverage beverage2 = new Module2(beverage); //使用装饰类装饰对象
        System.out.println(beverage2.getDescription()+"  cost: "+beverage2.cost());

        beverage = new Module2(beverage); //使用装饰类装饰对象
        System.out.println(beverage.getDescription()+"  cost: "+beverage.cost());
    }
}
